import InteractiveBase from "../../../LevelCommon/InteractiveBase";

/** 闹钟指针 一次旋转30度*/
export default class HourPoint extends InteractiveBase {
    /** 当前旋转y角度*/
    private curRotateAngle: number = 0;
    /** 是否已经达到准确点*/
    private haveReceive: boolean = false;
    /** 需要旋转的角度*/
    private needRotateAngle: number = 120;

    private mowner: Laya.Sprite3D;
    /** 点一下旋转30度*/
    protected InteractiveLogic(): boolean {
        this.mowner = this.owner as Laya.Sprite3D;
        if (this.haveReceive) {
            return true;
        }
        this.curRotateAngle += 30;
        this.curRotateAngle = this.curRotateAngle % 360;
        this.mowner.transform.rotate(new Laya.Vector3(0, 30, 0),true,false);
        return true;
    }
    /** 检测 是否对了*/
    public CheckIsTrue(): boolean {
        if (this.curRotateAngle == this.needRotateAngle) {
            this.haveReceive = true;
            this.CallToLevel();
            return true;
        }
        else {
            return false;
        }
    }
}